﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VRB_0._1
{
    class DuctTapeEnemy: Enemy
    {
        public Animation MovingLeftAnimation, MovingRightAnimation;

        public void Initialize(Viewport viewport, ContentManager Content, Vector2 position, Direction startDirection)
        {
            MovingLeftAnimation = new Animation();
            Texture2D MovingLeftTexture = Content.Load<Texture2D>("ducttape");
            MovingLeftAnimation.Initialize(MovingLeftTexture, Vector2.Zero, 50, 50, 0, 0, 0, 22, 20, Color.White, 1f, true, false);
            
            MovingRightAnimation = new Animation();
            Texture2D MovingRightTexture = Content.Load<Texture2D>("ducttape");
            MovingRightAnimation.Initialize(MovingRightTexture, Vector2.Zero, 50, 50, 0, 0, 0, 22, 20, Color.White, 1f, true, true);
            
            base.Initialize(viewport, MovingRightAnimation, position, startDirection);
        }
        public override void Update(GameTime gameTime)
        {
            lastPosition = Position;

            if (direction == Direction.LEFT)
            {
                Position.X -= MoveSpeed;
                MovingLeftAnimation.Position = Position;
                MovingLeftAnimation.Update(gameTime);
            }
            else
            {
                Position.X += MoveSpeed;
                MovingRightAnimation.Position = Position;
                MovingRightAnimation.Update(gameTime);
            }
        }
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (direction == Direction.LEFT)
                MovingLeftAnimation.Draw(spriteBatch);
            else
                MovingRightAnimation.Draw(spriteBatch);
        }

        public override void Restart()
        {
            base.Restart();
        }
    }
}
